environment variables based on attributes of the request. The
<em>attribute</em> specified in the first argument can be one of three
things:</p>
<ol>
<li>An HTTP request header field (see <a href="http://www.rfc-editor.org/rfc/rfc2616.txt">RFC2616</a>
for more information about these); for example: <code>Host</code>,
<code>User-Agent</code>, <code>Referer</code>, and
<code>Accept-Language</code>. A regular expression may be
used to specify a set of request headers.</li>
<li>One of the following aspects of the request:
<ul>
<li><code>Remote_Host</code> - the hostname (if available) of
the client making the request</li>
<li><code>Remote_Addr</code> - the IP address of the client
making the request</li>
<li><code>Server_Addr</code> - the IP address of the server
on which the request was received (only with versions later
than 2.0.43)</li>
<li><code>Request_Method</code> - the name of the method
being used (<code>GET</code>, <code>POST</code>, <em>et
cetera</em>)</li>
<li><code>Request_Protocol</code> - the name and version of
the protocol with which the request was made (<em>e.g.</em>,
"HTTP/0.9", "HTTP/1.1", <em>etc.</em>)</li>
<li><code>Request_URI</code> - the resource requested on the HTTP
request line -- generally the portion of the URL
following the scheme and host portion without the query string</li>
</ul>
</li>
<li>The name of an environment variable in the list of those
associated with the request. This allows
<code class="directive">SetEnvIf</code> directives to test against the result
of prior matches. Only those environment variables defined by earlier
<code>SetEnvIf[NoCase]</code> directives are available for testing in
this manner. 'Earlier' means that they were defined at a broader scope
(such as server-wide) or previously in the current directive's scope.
Environment variables will be considered only if there was no match
among request characteristics and a regular expression was not
used for the <em>attribute</em>.</li>
</ol>
<p>The second argument (<em>regex</em>) is a <a class="glossarylink" href="../glossary.html#regex" title="see glossary">regular expression</a>. If the <em>regex</em>
matches against the <em>attribute</em>, then the remainder of the
arguments are evaluated.</p>
<p>The rest of the arguments give the names of variables to set, and
optionally values to which they should be set. These take the form
<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Apache 1.3 and above</td></tr>
</table>
<p>The <code class="directive">SetEnvIfNoCase</code> is semantically identical to
the <code class="directive"><a href="#setenvif">SetEnvIf</a></code> directive,
and differs only in that the regular expression matching is
performed in a case-insensitive manner. For example:</p>
<div class="example"><p><code>
SetEnvIfNoCase Host Apache\.Org site=apache
</code></p></div>
<p>This will cause the <code>site</code> environment variable
to be set to "<code>apache</code>" if the HTTP request header
field <code>Host:</code> was included and contained
<code>Apache.Org</code>, <code>apache.org</code>, or any other
combination.</p>
</div>
</div>
<div class="bottomlang">
<p><span>Available Languages: </span><a href="../en/mod/mod_setenvif.html" title="English"> en </a> |
<a href="../ja/mod/mod_setenvif.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
<a href="../ko/mod/mod_setenvif.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p>
</div><div id="footer">
<p class="apache">Copyright 1995-2006 The Apache Software Foundation or its licensors, as applicable.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>